import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import './style.css'
import App from './App.vue'
import router from './router'

import { Popup, Toast, Lazyload, Loading, Dialog } from 'vant';
import 'vant/lib/index.css';

import '@/assets/style/common.scss'

import { useScriptTag } from '@vueuse/core'

import Load from '@/components/load/index.vue'

import VueGtag from "vue-gtag"

useScriptTag('https://securepubads.g.doubleclick.net/tag/js/gpt.js')

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app = createApp(App)

app.component('Load', Load)

app.use(router).use(pinia)
app.use(Popup)
.use(Toast)
.use(Lazyload, {
    lazyComponent: true
})
.use(Loading)
.use(Dialog)

app.use(VueGtag, {
    pageTrackerTemplate(to) {
        return {
            page_title: to.name,
            page_path: to.path
        }
    },
    appName: 'Lucky Dramas',
    pageTrackerScreenviewEnabled: true,
    config: {
        id: 'G-6TYL94D8LG'
    }
}, router)

app.mount('#app')